//
// Created by 74354 on 2022/1/21.
//

#ifndef MYODRIVE_MYCAN_H
#define MYODRIVE_MYCAN_H

#include <list>
#include "FrameBase.h"

/*
 * @brief HardWare information
 *        config the hardware infornation
 *
 * */
struct HardWareInfo{
    float Tq;
    canU8_t nPTS;
    canU8_t nPBS1;
    canU8_t nPBS2;
    canU32_t baudRate;
    canU32_t getBaudRate() const{return 1 / (Tq*(canU32_t)(nPTS + nPBS1 + nPBS2));}
};



class CAN : public HardWareInfo{
public:
    CAN() = default;
    bool HasBitStuffing;

    void (*sendData)(FrameData* data,canU8_t len);  // 定义指针指向发送的函数，用户自己实现，且每个对象可指向不同的发送函数。

    CANError Transmit(FrameData* data,canU8_t len);
    CANError TransmitRemote(canU8_t len);
    CANError TransmitWaitACK(FrameData* data,canU8_t len);
    CANError Receive();
    CANError ReceiveACK();

private:


};


#endif //MYODRIVE_MYCAN_H
